home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 602 < prev    next >
Text File  |  1996-08-06  |  2KB  |  45 lines

  1. Newsgroups: comp.std.c
  2. Path: blackbush.xlink.net!slsv6bt!news
  3. From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
  4. Subject: Re: BoundsChecker and fgets fmalloc problems
  5. In-Reply-To: bri@primenet.com's message of 18 Mar 1996 12:48:01 -0700
  6. Message-ID: <KANZE.96Mar19110432@slsvhrt.lts.sel.alcatel.de>
  7. Sender: news@lts.sel.alcatel.de
  8. Organization: GABI Software, Sarl.
  9. References: <4ikelh$gji@nnrp1.news.primenet.com>
  10. Date: 19 Mar 1996 10:04:31 GMT
  11.  
  12. In article <4ikelh$gji@nnrp1.news.primenet.com> bri@primenet.com (Brian
  13. Gregory) writes:
  14.  
  15. |> I am using Bounds Checker v2.5, and am having a problem finding a
  16. |> memory leak it is reporting...
  17.  
  18. |> Example:
  19.  
  20. |> fgets( szBuf, 799, fpIn );
  21.  
  22. |> szBuf is an 800 character buffer (pre-sized array)
  23. |> fpIn IS a valid pointer
  24. |> no memory is corrupt before the fgets line
  25. |> The application is a windows app, written in straight C with a large
  26. |> memory model.
  27.  
  28. |> The problem is Boundschecker consistently reports memory leaks for the
  29. |> larger buffer size mallocs contained WITHIN the fgets function...
  30.  
  31. Is fpIn ever closed?  (If it is stdin, it normally won't be.)  Most
  32. implementations of stdio will allocate a large buffer (for buffering
  33. purposes) on the first IO to the file, and free it when the file is
  34. closed.  If the file is never closed...
  35.  
  36. All of the memory checkers I'm familiar with (Purify and my own) have
  37. the possibility to state that certain `leaks' are normal, and shouldn't
  38. be mentioned.
  39. -- 
  40. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  41. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  42. Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
  43.                 -- A la recherche d'une activitΘ dans une region francophone
  44.  
  45.